new Vue({
    el:'#notebook',
    data:{
        content:'this is note',   
        notes: [
            {id:1,title:'title1',content:'this is content1'},  
           

            { id:2,title:'title2',content:'this is content2'},  
           

        ]//初始化空数组
    },

    computed:{
        preview:function(){
            return marked(this.content)
        }
    },

    watch:{
        content: function(val,old){
            //console.log('new content: ' +val)
            localStorage.setItem('markdown_editor_content',this.content)
        }
    },
    created: function(){
        this.content=localStorage.getItem('markdown_editor_content')


    },

    methods: {
        //添加内容
        addNote: function(){
            this.notes.push({
                id:Date.now(),
                title:'test Note ',
                content:'test content.'
            })
        }
    }
})
